//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2012 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : leapfrog.h
// Author     : M.A. de Jong
//----------------------------------------------------------------------------

#ifndef LEAPFROG_H
#define LEAPFROG_H

#include "kernels/leapfrog_kernels.h"

namespace wavescomputer
{

template <class T>
inline void leapfrog(T* phi, T* zeta,
                     const T* dt_phi, const T* dt_zeta,
                     const T* zetam1, const T* zetam2,
                     const T* phim1, const T* phim2,
                     const T* alfa_brk,
                     const T dt_new, const T dt_old,
                     const int nx, const int ny,
                     const int Nx1, const int Nx2)
{
    dimGrid.x = nx / NUM_THREADS_X;
    dimGrid.y = ny / NUM_THREADS_Y;
    dimBlock.x = NUM_THREADS_X;
    dimBlock.y = NUM_THREADS_Y;

    kernel_leapfrog<T> <<< dimGrid, dimBlock >>> 
        (phi, zeta,
         dt_phi, dt_zeta,
         zetam1, zetam2,
         phim1, phim2,
         alfa_brk,
         dt_new, dt_old,
         nx,
         Nx1, Nx2);
    checkCudaError(cudaGetLastError(), "wavescomputer::kernel_leapfrog");
}





} // namespace wavescomputer

#endif // LEAPFROG_H

